package online.misscl.lsy.controller.front;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import online.misscl.lsy.controller.BaseController;
import online.misscl.lsy.entity.dto.GetHospitalBySortDTO;
import online.misscl.lsy.entity.dto.vo.HospitalInformationVo;
import online.misscl.lsy.entity.dto.vo.TableDataInfoVo;
import online.misscl.lsy.service.HospitalInformationService;
import online.misscl.lsy.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 医院信息表 前端控制器
 * </p>
 *
 * @author misscl
 * @since 2023/03/11 11:14
 */
@RestController
@RequestMapping("/front/hospitalInformation")
@Api(tags = "医院模块")
public class HospitalInformationController extends BaseController {
    @Autowired
    private HospitalInformationService hospitalInformationService;

    @ApiOperation(value = "根据疫苗种类查医院")
    @GetMapping("/getHospitalBySort")
    public TableDataInfoVo<List<HospitalInformationVo>> getHospitalBySort(GetHospitalBySortDTO getHospitalBySortDTO) {
        List<HospitalInformationVo> list = hospitalInformationService.getHospitalBySort(getHospitalBySortDTO.getSortId());
        Page page = PageUtil.getPages(getHospitalBySortDTO.getPageNum(),getHospitalBySortDTO.getPageSize(),list);
        return getDataTable(page.getRecords(),page.getTotal());
    }
}
